function [ average ] = getAverageNeighbors(img, i, j, channel, kernelValue)

average = 0;
[w,h,c] = size(img);

for a = i-2:i+2
    if(a < 1 || a > h)
        continue;
    end
    
    for b = j-2:j+2
        if(b < 1 || b > w)
            continue;
        end
        
        average = average + img(a,b,channel) * kernelValue;
    end
end

end